package com.charger.transactionflow.service.impl;

import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.charger.transactionflow.mapper.TransactionflowMapper;
import com.charger.transactionflow.domain.Transactionflow;
import com.charger.transactionflow.service.ITransactionflowService;

/**
 * 账单流水Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-11-23
 */
@Service
public class TransactionflowServiceImpl implements ITransactionflowService 
{
    @Autowired
    private TransactionflowMapper transactionflowMapper;

    /**
     * 查询账单流水
     * 
     * @param transactionflowId 账单流水主键
     * @return 账单流水
     */
    @Override
    public Transactionflow selectTransactionflowByTransactionflowId(Long transactionflowId)
    {
        return transactionflowMapper.selectTransactionflowByTransactionflowId(transactionflowId);
    }

    /**
     * 查询账单流水列表
     * 
     * @param transactionflow 账单流水
     * @return 账单流水
     */
    @Override
    public List<Transactionflow> selectTransactionflowList(Transactionflow transactionflow)
    {
        return transactionflowMapper.selectTransactionflowList(transactionflow);
    }

    /**
     * 新增账单流水
     * 
     * @param transactionflow 账单流水
     * @return 结果
     */
    @Override

    public int insertTransactionflow(Transactionflow transactionflow) {

        Date time = transactionflow.getTradingHours();
        if (time==null){
            transactionflow.setTradingHours(new Date());
        }
        return transactionflowMapper.insertTransactionflow(transactionflow);
    }

    /**
     * 修改账单流水
     * 
     * @param transactionflow 账单流水
     * @return 结果
     */
    @Override
    public int updateTransactionflow(Transactionflow transactionflow)
    {
        return transactionflowMapper.updateTransactionflow(transactionflow);
    }

    /**
     * 批量删除账单流水
     * 
     * @param transactionflowIds 需要删除的账单流水主键
     * @return 结果
     */
    @Override
    public int deleteTransactionflowByTransactionflowIds(Long[] transactionflowIds)
    {
        return transactionflowMapper.deleteTransactionflowByTransactionflowIds(transactionflowIds);
    }

    /**
     * 删除账单流水信息
     * 
     * @param transactionflowId 账单流水主键
     * @return 结果
     */
    @Override
    public int deleteTransactionflowByTransactionflowId(Long transactionflowId)
    {
        return transactionflowMapper.deleteTransactionflowByTransactionflowId(transactionflowId);
    }
}
